function getKetchersmi(kframe)
{
	//kframe = 'ketcherFrame';
	var ketcher = null;
	var frame = null;
	
	if ('frames' in window && kframe in window.frames)
		frame = window.frames[kframe];
	else
		return null;
				
	if ('window' in frame)
		ketcher = frame.window.ketcher;
		//return frame.window.ketcher;
	return ketcher.getSmiles();
}
function getKetchermol(kframe)
{
	//kframe = 'ketcherFrame';
	var ketcher = null;
	var frame = null;
	
	if ('frames' in window && kframe in window.frames)
		frame = window.frames[kframe];
	else
		return null;
				
	if ('window' in frame)
		ketcher = frame.window.ketcher;
		//return frame.window.ketcher;
	return ketcher.getMolfile();
}
function getv(khidden){
	kframe = "f_"+khidden;
	mol = getKetchermol(kframe);
	oldmol = document.getElementById(khidden).value;
	if(oldmol != mol){
		document.getElementById(khidden).value=mol;
		smi = getKetchersmi(kframe);
		$.ajax({
	        url: "/compound/jj/id/1",
	        type:"post",
	        data:{s:smi},
	        cache: false,
	        success: function(html){
	            $("#divtablelist").html(html);
	        }
	    });	
	}
}
function setv(khidden,mol){
	mol = mol.replace(/####/g,"\n");
	//alert(mol);
	var kframe = "f_"+khidden;
	var ketcher = null;
	var frame = null;
	
	if ('frames' in window && kframe in window.frames)
		frame = window.frames[kframe];
	else
		return null;
				
	if ('window' in frame)
		ketcher = frame.window.ketcher;
		//return frame.window.ketcher;	
	ketcher.setMolecule(mol);
	//alert(ketcher);
	//alert(mol);
	getv(khidden);
}